// 防抖函数
// 用法示例： methods：{ testFun: _debounce(function(params){}, 500)}
export const _debounce = (fn, t) => {
  const delay = t || 500
  let timer = null
  return function () {
    const args = arguments
    if (timer) {
      clearTimeout(timer)
    }
    timer = setTimeout(() => {
      fn.apply(this, args)
      timer = null
    }, delay)
  }
}
